FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}

{% block placement_base_header %}{% endblock %}

{% import "macros.j2" as macros with context %}

{{ macros.configure_user(name='placement') }}

{% if base_package_type == 'rpm' %}

    {% set placement_base_packages = [
    ] %}

{% elif base_package_type == 'deb' %}

    {% set placement_base_packages = [
    ] %}

{% endif %}

{{ macros.install_packages(placement_base_packages | customizable("packages")) }}

ADD placement-base-archive /placement-base-source
ADD plugins-archive /

{% set placement_base_pip_packages = [
    '/placement'
] %}

COPY extend_start.sh /usr/local/bin/kolla_extend_start

RUN ln -s placement-base-source/* placement \
    && {{ macros.install_pip(placement_base_pip_packages | customizable("pip_packages")) }} \
    && mkdir -p /etc/placement/ \
    && cp -r /placement/etc/placement/* /etc/placement/ \
    && touch /usr/local/bin/kolla_placement_extend_start \
    && chmod 644 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_placement_extend_start

{% block placement_base_footer %}{% endblock %}
